<div id="map1" style="height: 100%">

</div>
<script type="text/javascript">
    function oldMaps1(type) {
        $.ajax({
            url: "#springUrl('/network/supply/costing/getDataMap1')",
            data: {"batchId": "","type":type,"selected":""},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var convertData = function (data) {
                        var res = [];
                        for (var i = 0; i < data.length; i++) {
                            var geoCoord = d.data.map1[data[i].name];
                            if (geoCoord) {
                                res.push({
                                    name: data[i].name,
                                    value: geoCoord.concat(data[i].value)
                                });
                            }
                        }
                        return res;
                    };

                    var myChartMap1 = echarts.init(document.getElementById('map1'), 'macarons');
                    var planePathMap1 = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z';
                    var colorMap1 = ['#a6c84c', '#ffa022', '#46bee9', '#D1E9B1', '#7DFF21'];
                    var seriesMap1 = [];
                    var legendMap1 = [];
                    var optionMap1 = {
                        backgroundColor: '#404a59',
                        title: {
                            text: '全国主要城市空气质量',
                            subtext: 'data from PM25.in',
                            sublink: 'http://www.pm25.in',
                            x:'center',
                            textStyle: {
                                color: '#fff'
                            },
                            show:false
                        },
                        tooltip: {
                            trigger: 'item',
//                            formatter: function (params) {
//                                return params.name + ' : ' + params.value[2];
//                            }
                        },
                        legend: {
                            orient: 'vertical',
                            y: 'bottom',
                            x:'right',
                           // data:['pm2.5'],
                            textStyle: {
                                color: '#fff'
                            }
                        },
                        visualMap: {
                            min: 0,
                            max: 200,
                            calculable: true,
                            color: ['#f4e925'],
                            textStyle: {
                                color: '#fff'
                            }
                        },
                        geo: {
                            map: 'china',
                            label: {
                                emphasis: {
                                    show: true
                                }
                            },
                            roam: true,
                            itemStyle: {
                                normal: {
                                    areaColor: '#323c48',
                                    borderColor: '#111'
                                },
                                emphasis: {
                                    areaColor: '#2a333d'
                                }
                            }
                        },
                        series: [
                            {
                                name: '',
                                type: 'scatter',
                                coordinateSystem: 'geo',
                                data: convertData(d.data.map2),
                                symbolSize: 12,
                                label: {
                                    normal: {
                                        formatter: '{b}',
                                        position: 'right',
                                        show: true
                                    },
                                    emphasis: {
                                        show: false
                                    }
                                },
                                itemStyle: {
                                    emphasis: {
                                        borderColor: '#fff',
                                        borderWidth: 1
                                    }
                                }
                            }
                        ]
                        // series: seriesMap1
                    };
                    myChartMap1.setOption(optionMap1,true);
                }else{
                    toastr.error('没有数据，请上传配送中心数据');
                    var div1="<div type='text' style='padding-top:18%' class=' text-center '>"+d.message+"</div>";
                    document.getElementById('map1').innerHTML=div1;
                }
            }
        });
    }
</script>